﻿<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">

    <title>${setting.siteName} - 物流表管理</title>
    <meta name="keywords" content="${setting.siteName}">
    <meta name="description" content="${setting.siteName}">

    <!-- BEGIN HEADER -->
    [#include "/admin/include/style.ftl"]
    <!-- END HEADER -->
    <style type="text/css">
        .btn {
            margin: 0 5px;
        }
    </style>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content  animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <form id="listForm" action="list.jhtml" method="get">
                    <div class="ibox-title">
                        <h5>物流表管理 </h5>
                        <div class="ibox-tools">
                            <a class="btn btn-outline btn-success btn-xs" id="btn-add-loippi" href="add.jhtml"><i
                                        class="fa fa-plus"></i> 新增</a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                            <div class="col-sm-2 m-b-xs">
                                <div class="input-group">
                                    <span class="input-group-addon">订单状态</span>
                                    <select name="filter_state" class="form-control">
                                        <option value="">全部</option>
                                        <option value="2" [#if paramter.state == 2]selected="selected"[/#if]>待发货
                                        </option>
                                        <option value="3" [#if paramter.state == 3]selected="selected"[/#if]>已发货
                                        </option>
                                        <option value="4" [#if paramter.state == 4]selected="selected"[/#if]>已送达
                                        </option>
                                        <option value="5" [#if paramter.state == 5]selected="selected"[/#if]>已签收
                                        </option>
                                        <option value="-1" [#if paramter.state == -1]selected="selected"[/#if]>已取消
                                        </option>
                                    </select>
                                </div>
                            </div>
                            <div class="col-sm-2 m-b-xs">
                                <input type="text" placeholder="请输入物流信息" name="filter_contentLike"
                                       value="${(paramter.content)!''}" class="form-control">
                            </div>
                            <div class="col-sm-2 m-b-xs">
                                <input type="text" placeholder="请输入用户名" name="filter_nameLike"
                                       value="${(paramter.name)!''}" class="form-control">
                            </div>
                            <div class="col-sm-3 m-b-xs">
                                <div class="input-group">
                                    <span class="input-group-addon">创建时间</span>
                                    <input type="text" id="startTime" class="form-control" name="filter_createTimes"
                                           value="${(paramter.createTimes)!''}"
                                           onclick="laydate({istime: false, format: 'YYYY-MM-DD'})"
                                           placeholder="选择起止时间" readonly="readonly">
                                    <span class="input-group-addon">至</span>
                                    <input type="text" id="endTime" class="form-control" name="filter_createTimee"
                                           value="${(paramter.createTimee)!''}"
                                           onclick="laydate({istime: false, format: 'YYYY-MM-DD'})"
                                           placeholder="选择结束时间" readonly="readonly">
                                </div>
                            </div>
                            <div class="col-sm-2">
                                <div class="input-group">
                                    <button type="submit" class="btn btn-sm btn-primary loippi-search-button">搜索
                                    </button>
                                    <button class="btn btn-sm btn-info" onclick="resetForm()">重置</button>
                                </div>
                            </div>
                        </div>
                        <div class="dataTables_wrapper form-inline">
                            <table class="table table-striped table-bordered table-hover dataTables-example dataTable">
                                <thead>
                                <tr>
                                    <th><input type="checkbox" class="i-checks" name="checkAll"></th>
                                    <th>订单编号</th>
                                    <th>用户名</th>
                                    <th>联系方式</th>
                                    <th>物流名称</th>
                                    <th>物流编号</th>
                                    <th>运费</th>
                                    <th>物流信息</th>
                                    <th>物流状态</th>
                                    <th>下单时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                [#list page.content as tLogistics]
                                    <tr>
                                        <td>
                                            <input type="checkbox" class="i-checks" name="ids" value="${tLogistics.id}">
                                        </td>
                                        <td>${(tLogistics.order.orderSn)!''}</td>
                                        <td>${(tLogistics.order.userName)!''}</td>
                                        <td>${(tLogistics.order.phone)!''}</td>
                                        <td>${(tLogistics.logisticsName)!''}</td>
                                        <td>${(tLogistics.logisticsNum)!''}</td>
                                        <td>${(tLogistics.fee)!''}</td>
                                        <td>${(tLogistics.content)!''}</td>
                                        <td>[#switch (tLogistics.logisticsState)!'']
                                                [#case 2]
                                                    待发货
                                                    [#break]
                                                [#case 3]
                                                    已发货
                                                    [#break]
                                                [#case 4]
                                                    已送达
                                                    [#break]
                                                [#case 5]
                                                    已签收
                                                    [#break]
                                                [#case -1]
                                                    已取消
                                                    [#break]
                                                [#default]
                                                    待发货
                                            [/#switch]
                                        </td>
                                        <td>${(tLogistics.order.orderTime?string('yyyy-MM-dd HH:mm:ss'))!''}</td>
                                        <td>
                                            <a class="btn btn-info btn-xs btn-edit-loippi" data-id="${tLogistics.id}"
                                               href="edit/${tLogistics.id}.jhtml"><i
                                                        class="fa fa-paste"></i> ${message("admin.common.edit")} </a>
                                        </td>
                                    </tr>
                                [/#list]
                                </tbody>
                            </table>
                            [@pagination pageNumber = page.pageNumber totalPages = page.totalPages]
                                [#include "/admin/include/pagination.ftl"]
                            [/@pagination]
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<!-- BEGIN Script -->
[#include "/admin/include/script.ftl"]
<!-- END Script -->

<script>

    $(document).ready(function () {
        [@flash_message /]
    });

    // 时间控件设置结束时间必须大于开始时间
    var startDate;
    var endDate;
    startDate = laydate.render({
        elem: '#startTime'
        , trigger: 'click'
        , type: 'date'
        , done: function (value, date) {
            if (value !== '') {
                endDate.config.min.year = date.year;
                endDate.config.min.month = date.month - 1;
                endDate.config.min.date = date.date;

            } else {
                endDate.config.min.year = '';
                endDate.config.min.month = '';
                endDate.config.min.date = '';
            }
        }
    });
    endDate = laydate.render({
        elem: '#endTime'
        , type: 'date'
        , min: '1970-01-01'
        , max: '2099-06-16'
        , done: function (value, date) {
            if (value !== '') {
                startDate.config.max.year = date.year;
                startDate.config.max.month = date.month - 1;
                startDate.config.max.date = date.date;
            } else {
                startDate.config.max.year = '';
                startDate.config.max.month = '';
                startDate.config.max.date = '';
            }
        }
    });

    // 重置form表单
    function resetForm() {
        $(':input', '#listForm')
            .not(':button, :submit, :reset, :hidden')
            .val('')
            .removeAttr('checked')
            .removeAttr('selected');
    }
</script>
</body>

</html>
